﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using OpenQuarters.WebQuarters.Core;
using OpenQuarters.WebQuarters.Utils;

namespace OpenQuarters.WebQuarters.Modules.Registration
{
    public class RegistrationModule : Module
    {

        public static Dictionary<string, string> AvailableForms
        {
            get
            {
                Dictionary<string, string> d = new Dictionary<string, string>();
                d.Add("", "[None]");

                foreach (string path in System.IO.Directory.GetFiles(Oracle.Request.MapPath("~/Forms/"), "*.tpl"))
                {
                    d.Add(System.IO.Path.GetFileNameWithoutExtension(path), System.IO.Path.GetFileName(path));
                }

                return d;
            }
        }

        public static Dictionary<string, string> Roles
        {
            get
            {
                Dictionary<string, string> d = new Dictionary<string, string>();

                foreach (Role role in Role.Table.ToList())
                {
                    d.Add(role.RoleId, role.Name);
                }

                return d;
            }
        }

    }
}
